<template>
	<view class="page">
		<view class="page flex flex-column flex-center" v-if="list.length<=0&&loading==='nomore'">
			<image src="@/static/empty.png" style="width:120px;height: 120px;" />
			<view class="text-primary-light-1 mt-2">空空如也~</view>
		</view>
		<view class="p-4" v-else>
			<view class="flex flex-center p-4 rounded-4 bg-white mb-4" v-for="item in list" :key="item.id">
				<view class="flex-1">
					<view class="font-weight-600 mb-2">{{ item.title }}</view>
					<view class="h10 text-dark-light-5">{{ item.trade }}</view>
				</view>
				<view class="text-right">
					<view class="text-primary font-weight-600">{{ item.price }}
					</view>
					<view class="h10">{{item.state_text}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import { $page,$http } from '@/utils';
const search = ref({
	page:1
});
const list=ref([]);
onLoad(() => {
    $page.title('订单中心');
	getList();
})
const loading = ref('more');
const getList = () => {
	if (loading.value==='loading'||loading.value==='nomore') {
		return;
	}
	loading.value = 'loading';
	$http.get('Orders/list', {
		data: search.value
	}).then((res: any) => {
		loading.value = 'nomore';
		if (res.code === $http.ResponseCode.SUCCESS) {
			list.value=res.data
		}
	}).catch((err: any) => {
		loading.value = 'nomore';
	})
}
</script>

<style lang="scss" scoped>
.page {
	min-height: calc(100vh - var(--window-top));
}
</style>
